import random

teachers = ['t1', 't2', 't3', 't4', 't5', 't6', 't7', 't8']
office = [[], [], []]
for i in teachers:
    office[random.randint(0, len(office) - 1)].append(i)
for i in range(len(office)):
    print(f'办公室{i + 1}有{len(office[i])}人,为：')
    for name in office[i]:
        print(name, end='\t')
    print()
